package com.xieyingwangluo.yxpart.api;

import com.xieyingwangluo.yxpart.bean.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

@CrossOrigin
@Api(tags = "不能使用,编写中.....user_education接口")
@Controller
@RequestMapping(value = "/api/v1/user_edu")
public class UserEducationBaseRest extends BaseRest {
    @ApiOperation(value = "添加教育背景", notes = "添加教育背景", produces = "application/json")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "名称", required = true, dataType = "String", paramType = "form", defaultValue = "张三"),
            @ApiImplicitParam(name = "major", value = "专业", required = true, dataType = "String", paramType = "form", defaultValue = "土木工程"),
            @ApiImplicitParam(name = "enrollment", value = "入学时间", required = true, dataType = "String", paramType = "form", defaultValue = "2014-10-12"),
            @ApiImplicitParam(name = "graduation", value = "毕业时间", required = true, dataType = "String", paramType = "form", defaultValue = "2014-10-12"),
            @ApiImplicitParam(name = "info", value = "在校经历", required = true, dataType = "String", paramType = "form", defaultValue = "无"),
            @ApiImplicitParam(name = "user_id", value = "用户id", required = true, dataType = "String", paramType = "form", defaultValue = "123456")
    })
    @ResponseBody
    @PostMapping(value = "/add")
    public Result add(@RequestHeader(name = "Authorization", defaultValue = "token") String token,
                      @RequestParam("name") String name,
                      @RequestParam("major") String major,
                      @RequestParam("enrollment") String enrollment,
                      @RequestParam("graduation") String graduation,
                      @RequestParam("info") String info,
                      @RequestParam("user_id") String user_id
    ) {
        logger.info("获取用户信息 start....");
        return Result.generate(0, "添加成功", null);
    }

    @ApiOperation(value = "修改教育背景", notes = "修改教育背景", produces = "application/json")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "noid", value = "教育背景id", required = true, dataType = "String", paramType = "query", defaultValue = "123456"),
            @ApiImplicitParam(name = "name", value = "名称", required = true, dataType = "String", paramType = "query", defaultValue = "张三"),
            @ApiImplicitParam(name = "major", value = "专业", required = true, dataType = "String", paramType = "query", defaultValue = "土木工程"),
            @ApiImplicitParam(name = "enrollment", value = "入学时间", required = true, dataType = "String", paramType = "query", defaultValue = "2014-10-12"),
            @ApiImplicitParam(name = "graduation", value = "毕业时间", required = true, dataType = "String", paramType = "query", defaultValue = "2014-10-12"),
            @ApiImplicitParam(name = "info", value = "在校经历", required = true, dataType = "String", paramType = "query", defaultValue = "无"),
            @ApiImplicitParam(name = "user_id", value = "用户id", required = true, dataType = "String", paramType = "query", defaultValue = "123456")
    })
    @ResponseBody
    @PutMapping(value = "/upd")
    public Result update(@RequestHeader(name = "Authorization", defaultValue = "token") String token,
                         @RequestParam("noid") String noid,
                         @RequestParam("name") String name,
                         @RequestParam("major") String major,
                         @RequestParam("enrollment") String enrollment,
                         @RequestParam("graduation") String graduation,
                         @RequestParam("info") String info,
                         @RequestParam("user_id") String user_id
    ) {
        logger.info("获取用户信息 start....");
        return Result.generate(0, "修改成功", null);
    }
    //显示：用户教育经历编号（noid）

    @ApiOperation(value = "显示教育背景", notes = "显示教育背景", produces = "application/json")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "noid", value = "教育背景id", required = true, dataType = "String", paramType = "query", defaultValue = "123456")
    })
    @ResponseBody
    @GetMapping(value = "/selO")
    public Result selO(@RequestHeader(name = "Authorization", defaultValue = "token") String token,
                       @RequestParam("noid") String noid
    ) {
        logger.info("获取用户信息 start....");
        return Result.generate(0, "查询成功", null);
    }

}
